package com.ynet.hmds28.user.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.boot.hsf.annotation.HSFProvider;
import com.ynet.hm.user.service.IdentityAuthService;
import com.ynet.hm.utils.config.Result;
import com.ynet.hm.utils.config.ResultUtil;
import com.ynet.hm.utils.enums.ExceptionEnum;
import com.ynet.hm.utils.exception.MyException;
import com.ynet.hmds28.user.dao.ServiceconsumeDao;
import com.ynet.hmds28.user.model.Serviceconsume;
import com.ynet.hmds28.user.model.ServiceconsumeQuery;
@Transactional
@HSFProvider(serviceInterface = IdentityAuthService.class, serviceVersion = "1.0.0",serviceGroup = "hmds28")
public class IdentityAuthServiceImpl implements IdentityAuthService {
	@Autowired	
	private ServiceconsumeDao serviceconsumeDao;
	@Override
	public Result<?> identityAuth(String merchantNo, String provideId) {
		ServiceconsumeQuery example = new ServiceconsumeQuery();
		example.createCriteria().andUseridEqualTo(merchantNo).andSeviceproviceidEqualTo(provideId);
		List<Serviceconsume> scList = serviceconsumeDao.selectByExample(example );
		if(scList == null || scList.size()==0){
			throw new MyException(ExceptionEnum.MERCHANTAUTH_IS_ERROR);
		}
		return ResultUtil.success();
	}

}
